package com.nbsaas.boot.data.rest.convert;

import com.nbsaas.boot.data.data.entity.QueryCatalog;
import com.nbsaas.boot.data.api.domain.response.QueryCatalogResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* -实体对象转化成响应对象
*/

public class QueryCatalogResponseConvert  implements Converter<QueryCatalogResponse,QueryCatalog> {

    @Override
    public QueryCatalogResponse convert(QueryCatalog source) {
        QueryCatalogResponse  result = new  QueryCatalogResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getParent()!=null){
                        result.setParent(source.getParent().getId());
                    }

                    try {
                        if(source.getParent()!=null){
                            result.setParentName(source.getParent().getName());
                        }
                    } catch (Exception ignored) { }

        return result;
    }

}

